﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerDetails.aspx.cs"
    Inherits="ZLDC.Estate.PM.CustomerDetails" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>客源详细信息</title>
    <base target="_self" />
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../js/jquery/style/jquery.hiAlerts.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    
    <script src="../js/LexunJS.js" type="text/javascript"></script>
    
    <script type="text/javascript">
        $(document).ready(function() {
            var id = LexunJS.GetQueryString("id"); // 楼盘ID

            // 修改
            if (id > 0) {                                
                showDetail(id);
            }
        });

        // 查询详细
        function showDetail(id) {
            $.ajax({
                type: 'POST',
                url: '../Handler/HandlerCustomer.ashx',
                data: 'act=customer_detail&id=' + id,
                timeout: '10000',
                error: function() {
                    alert("修改失败！");
                },
                success: function(json) {
                    showDetailCallBack(json);
                }
            });
        }

        function showDetailCallBack(response) {
            var json = eval("(" + response + ")");
            var record = json.record;

            if (record == null || record.length == 0) return;

            var sessionUserID = $("#hUserID").val();    // 当前登录用户
            var isManager = $("#hIsManager").val();     // 0不是 1是管理层
            var recordLength = record.length;
            for (var i = 0; i < recordLength; i++) {
                $("#sCustomer").text(record[i].customer);

                // 判断是否有权限查看
                if (record[i].ownerid == sessionUserID || (record[i].isself == 1 && record[i].mark1 != 1) || isManager == 1)
                    $("#sCustomerTel").text(record[i].customertel);
                else
                    $("#sCustomerTel").text("不是您的客源,请联系所属人");
                    
                $("#sOccupation").text(record[i].occupation);

                if (record[i].status == 0)
                    $("#sStatus").text("当前");
                else if (record[i].status == 1)
                    $("#sStatus").text("资料");

                $("#sAgent").text(record[i].agent);
                $("#sAgentTel").text(record[i].agenttel);
                $("#sTradetype").text(record[i].tradetype);
                $("#sUsage").text(record[i].usage);
                $("#sRemark").text(record[i].remark);
                $("#sCustomerClass").text(record[i].customerclass);
                $("#sInfoFrom").text(record[i].infofrom);
                $("#sDname").text(record[i].dname);
                $("#sArea").text(record[i].area);
                $("#sPayType").text(record[i].paytype);
                $("#sType").text(record[i].type);
                $("#sDirect").text(record[i].direct);
                
                if (record[i].isself == 0)
                    $("#sIsSelf").text("私客");
                else if (record[i].isself == 1)
                    $("#sIsSelf").text("公客"); 
                    
                $("#sFloor").text(record[i].minfloor + " ~ " + record[i].maxfloor);
                $("#sHouseStyle").text(record[i].housestyle);
                $("#sFitment").text(record[i].fitment);
                $("#sRoom").text(record[i].room + "房" + record[i].hall + "厅" + record[i].restroom + "卫" + record[i].balcony + "阳台");
                $("#sAcreage").text(record[i].minacreage + " ~ " + record[i].maxacreage);
                $("#sPrice").text(record[i].minprice + " ~ " + record[i].maxprice);
                $("#sAddUser").text(record[i].adduser);
                $("#sAddDept").text(record[i].adddept);
                $("#sOwner").text(record[i].owner);
                $("#sOwnerDept").text(record[i].ownerdept);
                $("#sOwnerTel").text(record[i].ownertel);                
            }
        }
    
    </script>
</head>
<body>
    <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
        <tr>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                客户名：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <font color="red"><span id="sCustomer"></span></font>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                客户电话：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <font color="red"><span id="sCustomerTel"></span></font>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                职业：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sOccupation"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                状态：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <font color="red"><span id="sStatus"></span></font>
            </td>
        </tr>
        <tr>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                代理人：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sAgent"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                代理人电话：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sAgentTel"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                交易：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sTradetype"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                用途：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sUsage"></span>
            </td>
        </tr>
        <tr>
            <td align="right" bgcolor="#F7F7F7">
                位置：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;" colspan="3">
                <span id="sRemark"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                等级：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sCustomerClass"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                来源：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sInfoFrom"></span>
            </td>
        </tr>
        <tr>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                城区：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sDname"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                片区：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sArea"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                付佣：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sPayType"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                房屋类型：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sType"></span>
            </td>
        </tr>
        <tr>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                朝向：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sDirect"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                客户类型：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sIsSelf"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                楼层：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sFloor"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                样式：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sHouseStyle"></span>
            </td>
        </tr>
        <tr>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                装修：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sFitment"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                户型：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sRoom"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                面积：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sAcreage"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                价格：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sPrice"></span>
            </td>
        </tr>
        <tr>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                录入人：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sAddUser"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                录入人部门：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sAddDept"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                所属人：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sOwner"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                所属人部门：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="sOwnerDept"></span>
            </td>
        </tr>
        <tr>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                所属人电话：
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">                
                <font color="red"><span id="sOwnerTel"></span></font>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="Span2"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="Span3"></span>
            </td>
            <td width="10%" align="right" bgcolor="#F7F7F7">
                
            </td>
            <td width="15%" bgcolor="#FFFFFF" style="padding-left: 10px;">
                <span id="Span4"></span>
            </td>
        </tr>
    </table>
    
    <input id="hUserID" name="hUserID" runat="server" type="hidden" />
    <input id="hIsManager" name="hIsManager" runat="server" value="0" type="hidden" />
</body>
</html>
